package com.esincrunch.tool;

import android.database.Cursor;

public class BlockItem {
	public static final String ID = "_id";
	public static final String SERVICENO = "serviceno";  
	public static final String SENDTEXT = "sendtext";  
	public static final String SENDTIME = "sendtime";   
	public static final String TYPENO = "typeno";    
	public static final String CRDAT = "crdat";    
	
	

	public String mServiceno;
	public String mSendtext;
	public String mTypeno;
	public long mID;
	public long mSendtime;
	public long mCrdat;
	

	private static int mServicenoIdx;
	private static int mSendtextIdx;
	private static int mTypenoIdx;
	private static int mIdIdx;
	private static int mSendtimeIdx;
	private static int mCrdatIdx;
	
	
	
	public BlockItem(Cursor cur) {
		mServiceno = cur.getString(mServicenoIdx);
		mSendtext = cur.getString(mSendtextIdx);
		mTypeno = cur.getString(mTypenoIdx);
		mID = cur.getLong(mIdIdx);
		mSendtime = cur.getLong(mSendtimeIdx);
		mCrdat = cur.getLong(mCrdatIdx);
		
	}
	
	public static void initIdx(Cursor cur) {
		mServicenoIdx = cur.getColumnIndex( SERVICENO );
		mSendtextIdx = cur.getColumnIndex( SENDTEXT );
		mTypenoIdx = cur.getColumnIndex( TYPENO );
		mIdIdx = cur.getColumnIndex( ID );
		mSendtimeIdx = cur.getColumnIndex( SENDTIME );
		mCrdatIdx = cur.getColumnIndex( CRDAT );
		
	}
	
	public String toString() {
		String ret = ID + ":" + String.valueOf(mID) + " " +
		SENDTIME + ":" + String.valueOf(mSendtime) + " " +   
		CRDAT + ":" + String.valueOf(mCrdat) + " " + 
		SERVICENO + ":" + mServiceno + " " +
		SENDTEXT + ":" + mSendtext + " " + 
		TYPENO + ":" + mTypeno; 
		return ret;
	}

}
